@include reader.awk
@include misc.awk
@include args2opt.awk
@include euclid.awk

BEGIN  { OFS = FS = ","; 
         args2opt("seed=1;m=50;k=20;n=100",Opt) 
       }
line() { sub(/^=/,"") ? head(Db,C) : genic(Db,C,Opt["k"]) }
END    { end() }

function head(db,c) { seed(Opt["seed"]); 
    header(c); header(db) }

function mInitial(db,cl,m,weight,   r) {
    empty(center)
    while(m--) {
        if(getline <= 0) return end()
        row(db)
        c=row(cl)
        cl["weight"][c]=1
}}
function eat(db,cl,r,c) {
    r=row(db)
    max=cl["rows"]
    for(1=
    
function move(c,p,w) { return (w*c + p)/(w+1) }

function end() {
    exit 0;
}
